﻿using System.Text;

namespace Baula.TextGen.Framework.Tools
{
    public class LineCollector
    {
        private readonly StringBuilder _stringBuilder;

        public LineCollector()
        {
            _stringBuilder = new StringBuilder();
        }

        private StringBuilder StringBuilder
        {
            get { return _stringBuilder; }
        }

        public void AppendAsNewLine(string line)
        {
            StringBuilder.AppendLine(line);
        }

        public override string ToString()
        {
            var temp = StringBuilder.ToString();

            if (temp.EndsWith("\r\n"))
            {
                temp = temp.Remove(temp.Length - 2);
            }

            return temp;
        }
    }
}